package com.ecommerce.recommendation.controller;

import com.ecommerce.recommendation.service.AnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

@RestController
@RequestMapping("/analysis")
public class AnalysisController {

    @Autowired
    private AnalysisService analysisService;

    @PostMapping("/upload")
    public Map<String, Object> uploadFile(@RequestParam("file") MultipartFile file) throws Exception {
        return analysisService.uploadFile(file);
    }

    @GetMapping("/customer-behavior")
    public Map<String, Object> getCustomerBehaviorAnalysis() throws Exception {
        return analysisService.getCustomerBehaviorAnalysis();
    }

    @GetMapping("/product-recommendation")
    public Map<String, Object> getProductRecommendationAnalysis() throws Exception {
        return analysisService.getProductRecommendationAnalysis();
    }

    @GetMapping("/seasonal-trend")
    public Map<String, Object> getSeasonalTrendAnalysis() throws Exception {
        return analysisService.getSeasonalTrendAnalysis();
    }

    @GetMapping("/regional-market")
    public Map<String, Object> getRegionalMarketAnalysis() throws Exception {
        return analysisService.getRegionalMarketAnalysis();
    }

    @GetMapping("/user-retention")
    public Map<String, Object> getUserRetentionAnalysis() throws Exception {
        return analysisService.getUserRetentionAnalysis();
    }
}